﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using medicine.BaseComponents.Groups;
using System.Drawing;

namespace medicine
{
    
    public partial class GroupLabel : Label, IDraggableControl 
    {
        public delegate void AfterRowSelectionHandler(Control Sender);
        public event AfterRowSelectionHandler AfterRowSelection;

        
        public Mover Mover { get; set; }

        public GroupInfo GroupInfo;

        public GroupLabel()
        {
            Mover = new Mover(this);
            GroupInfo = new GroupInfo();

            InitializeComponent();
        }

        public GroupLabel(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
        public void FireAfterRowSelection()
        {
            if (AfterRowSelection != null)
                AfterRowSelection(this);
        }
        
        public void SetColor()
        {
            if (this.GroupInfo.Selected.Count > 0)
                this.BackColor = Color.FromArgb(255, 153, 0);
            else
                this.BackColor = Color.FromArgb(0, 167, 231);
        }

        public void Reset()
        {
            this.GroupInfo.Reset();
            this.SetColor();
        }

        public void Copy(GroupInfo src)
        {
            this.GroupInfo.Copy(src);
            this.SetColor();
        }
    }
}
